package com.garen.fire.entity;

import javax.persistence.Column;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import com.alibaba.fastjson.JSONArray;
import com.garen.orm.annotation.Formula;


@Table(name="fire_car")
public class FireCar {
	
	@Formula(name="car_org_name",value="select tt.org_short_name "
			+ " from fire_org tt where tt.org_id = t.car_org_id")
	private String carOrgName;
	
	@Formula(name="car_type_name",value="select tt.code_name "
			+ " from fire_code tt where tt.code_value= t.car_type and tt.code_type = '3'")
	private String carTypeName;
	

	private JSONArray menList;
	
	/**
	*车牌号码
	*/
	@Column(name = "car_num",nullable=false)
	private String carNum;

	/**
	*关联UUID
	*/
	@Column(name = "car_uuid",nullable=false)
	private String carUuid;

	/**
	*部门ID
	*/
	@Column(name = "car_org_id",nullable=false)
	private Integer carOrgId;

	/**
	*车容量
	*/
	@Column(name = "car_capacity")
	private Integer carCapacity;

	/**
	*成员人数
	*/
	@Column(name = "car_man_count")
	private Integer carManCount;

	/**
	*车辆别名
	*/
	@Column(name = "car_alias",nullable=false)
	private String carAlias;

	/**
	*车辆状态:0 停用，1正常，2 维修
	*/
	@Column(name = "car_status",nullable=false)
	private String carStatus;
	
	/**
	*车辆类型
	*/
	@Column(name = "car_type")
	private String carType;

	/**
	*备注
	*/
	@Column(name = "bz")
	private String bz;

	/**
	*主键
	*/
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "car_id",nullable=false)
	private Integer carId;

	/**
	*gps设备号
	*/
	@Column(name = "device_id")
	private String deviceId;



	public String getCarNum() {
		return carNum;
	}

	public void setCarNum(String carNum) {
		this.carNum=carNum;
	}

	public String getCarUuid() {
		return carUuid;
	}

	public void setCarUuid(String carUuid) {
		this.carUuid=carUuid;
	}

	public Integer getCarOrgId() {
		return carOrgId;
	}

	public void setCarOrgId(Integer carOrgId) {
		this.carOrgId=carOrgId;
	}

	public Integer getCarCapacity() {
		return carCapacity;
	}

	public void setCarCapacity(Integer carCapacity) {
		this.carCapacity=carCapacity;
	}

	public Integer getCarManCount() {
		return carManCount;
	}

	public void setCarManCount(Integer carManCount) {
		this.carManCount=carManCount;
	}

	public String getCarAlias() {
		return carAlias;
	}

	public void setCarAlias(String carAlias) {
		this.carAlias=carAlias;
	}

	public String getCarType() {
		return carType;
	}

	public void setCarType(String carType) {
		this.carType=carType;
	}

	public String getBz() {
		return bz;
	}

	public void setBz(String bz) {
		this.bz=bz;
	}

	public Integer getCarId() {
		return carId;
	}

	public void setCarId(Integer carId) {
		this.carId=carId;
	}

	public String getDeviceId() {
		return deviceId;
	}

	public void setDeviceId(String deviceId) {
		this.deviceId=deviceId;
	}

	public String getCarOrgName() {
		return carOrgName;
	}

	public void setCarOrgName(String carOrgName) {
		this.carOrgName = carOrgName;
	}

	public String getCarTypeName() {
		return carTypeName;
	}

	public void setCarTypeName(String carTypeName) {
		this.carTypeName = carTypeName;
	}

	public JSONArray getMenList() {
		return menList;
	}

	public void setMenList(JSONArray menList) {
		this.menList = menList;
	}

	/*获取车辆信息*/
	public String getCarStatusName() {
		if(carStatus == null) carStatus = "";
		String str = null;
		switch(carStatus) {
		case "1":
			str = "正常";
			break;
		case "0":
			str = "停用";
			break;
		case "2":
			str = "维修";
			break;
		}
		return str;
	}
	
	public String getCarStatus() {
		return carStatus;
	}

	public void setCarStatus(String carStatus) {
		this.carStatus = carStatus;
	}

}
